#include<iostream>
#include<string>
#include<vector>

using namespace std;

class TheLockDivTwo
{
public:
    string password(int n, int k)
    {
        char i, c;
        string p;
        for (i=0; n>0; i++)
        {
            --n;
            c = k-1>>n&1;
            k-=c;
            //k-=c=k-1>>n&1;
            p += '0' + c;
        }
        return p;
    }
};
/*
struct TheLockDivTwo {
char i,c,p[99],*password(int n,int k) {
        for(;n;p[i++]=48+c)k-=c=k-1>>--n&1;
        return p;
    }
};
*/
/*
 * Priority Order:
 * --; Right to left;
 * -;
 * >>;
 * &;
 * -=, =; Right to left;
 * */
